package com.sanyue.codingsettlement.config;

import com.zhipu.oapi.ClientV4;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.TimeUnit;

/**
 * @author: Guan
 **/
@Configuration
@ConfigurationProperties(prefix = "api")
@Data
public class AiManagerConfig {


    private String aiKey;



    @Bean
    public ClientV4 getClientV4(){
        return new ClientV4.Builder(aiKey)
                //networkConfig：设置连接超时、读取超时、写入超时、ping间隔、ping超时时间
                .networkConfig(30, 60, 60, 30, TimeUnit.SECONDS)
                .build();
    }

}
